/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vzone.tools;

import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Kingpro
 */
public class MD5
{

    public static byte[] getMD5(String str)
    {
	try
	{
	    MessageDigest md = MessageDigest.getInstance("MD5");
	    md.update(str.getBytes(Charset.forName("UTF-8")));
	    return md.digest();
	}
	catch (NoSuchAlgorithmException ex)
	{
	    Logger.getLogger(MD5.class.getName()).log(Level.SEVERE, null, ex);
	    return null;
	}
    }
}
